#ifndef CHARACTERCLASS_H
#define CHARACTERCLASS_H

#include "dtwentycore_global.h"


#include <modelitemset.h>
#include <modelitem.h>
#include <QStringListModel>


class Skill;
class CharacterClassSkills;


class DTWENTYCORESHARED_EXPORT CharacterClass : public ModelItem
{
    Q_OBJECT

    Q_PROPERTY(QString acronym READ acronym WRITE setAcronym NOTIFY acronymChanged)
    Q_PROPERTY(int hitDie READ hitDie WRITE setHitDie NOTIFY hitDieChanged)
    Q_PROPERTY(int skillPoints READ skillPoints WRITE setSkillPoints NOTIFY skillPointsChanged)
    Q_PROPERTY(int baseAttack READ baseAttack WRITE setBaseAttack NOTIFY baseAttackChanged)
    Q_PROPERTY(int fortSave READ fortSave WRITE setFortSave NOTIFY fortSaveChanged)
    Q_PROPERTY(int refSave READ refSave WRITE setRefSave NOTIFY refSaveChanged)
    Q_PROPERTY(int willSave READ willSave WRITE setWillSave NOTIFY willSaveChanged)
    Q_PROPERTY(QStringList classSkills READ classSkills NOTIFY classSkillsChanged)
    Q_PROPERTY(int levels READ levels WRITE setLevels NOTIFY levelsChanged)


    QString m_acronym;
    int m_hitDie;
    int m_skillPoints;
    int m_baseAttack;
    int m_fortSave;
    int m_refSave;
    int m_willSave;
    int m_levels;


public:

    Q_INVOKABLE CharacterClass(QObject *parent = 0);
    CharacterClass(const CharacterClass& other);

    QString acronym() const;

    int hitDie() const;
    int skillPoints() const;
    int baseAttack() const;
    int fortSave() const;
    int refSave() const;
    int willSave() const;

    QStringList classSkills() const;
    int levels() const;

    Q_INVOKABLE QStringList specialAbilities(int level = -1) const;

//    Q_INVOKABLE bool isClassSkill(const QString& skillName) const;



signals:

    void acronymChanged(QString arg);

    void hitDieChanged(int arg);
    void skillPointsChanged(int arg);
    void baseAttackChanged(int arg);
    void fortSaveChanged(int arg);
    void refSaveChanged(int arg);
    void willSaveChanged(int arg);

    void classSkillsChanged();


    void levelsChanged(int arg);

public slots:

    void setAcronym(QString arg);
    void setHitDie(int arg);
    void setSkillPoints(int arg);
    void setBaseAttack(int arg);
    void setFortSave(int arg);
    void setRefSave(int arg);
    void setWillSave(int arg);

    void addClassSkill(Skill* skill);


    void setLevels(int arg);
};

Q_DECLARE_METATYPE(CharacterClass)


class CharacterClasses : public ModelItemSet<CharacterClass>
{
    Q_OBJECT

public:

    Q_INVOKABLE CharacterClasses(QObject* parent = 0) :
        ModelItemSet<CharacterClass>(parent)
    {
        setName("Character Classes");
    }

    CharacterClasses(const CharacterClasses& other) :
        ModelItemSet<CharacterClass>(other)
    {
    }

};

Q_DECLARE_METATYPE(CharacterClasses)


#endif // CHARACTERCLASS_H


